package hit.example.task;

import hit.example.Db.DbAnhViet;
import hit.example.Object.ObjWord;

import java.util.ArrayList;
import android.content.Context;

import com.telpoo.frame.model.BaseTask;
import com.telpoo.frame.model.TaskListener;
import com.telpoo.frame.model.TaskParams;

public class TaskDinh extends BaseTask implements TaskType{
	public TaskDinh(TaskListener taskListener, int taskType, ArrayList<?> list,
			Context context) {
		super(taskListener, taskType, list, context);
		// TODO Auto-generated constructor stub
	}

	@Override
	protected Boolean doInBackground(TaskParams... params) {

		DbAnhViet adp;
		switch (taskType) {
		case TASK_SEARCH_DATA:// thuc hien task o day
			String key = (String) dataFromModel.get(0); // lay key tu home
			int mlanguague=(Integer) dataFromModel.get(1);
			adp =DbAnhViet.getInstance(mlanguague, context);
			

			ArrayList<ObjWord> ojs = adp.getDatabase(key,mlanguague);
			dataReturn = ojs; // tra dư lieu ve fragment
			return TASK_DONE;// nghia la vao onSuccess
		
		default:
			break;
		}

		return super.doInBackground(params);
	}
}
